<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'contact.label', default: 'Contact')}"/>
    <title>客户管理</title>
</head>
<body class="fixed-navbar fixed-sidebar">
<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right">
                <ol class="hbreadcrumb breadcrumb">
                    <li>Cake Store</li>
                    <li class="active">
                        <span>客户</span>
                    </li>
                </ol>
            </div>

            <h2 class="font-light m-b-xs">
                客户
            </h2>
        </div>
    </div>
</div>
<div class="content animate-panel">
    <div class="row">
        <g:form method="POST" action="searchContact">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <button class="btn btn-primary btn-xs" type="submit"><i class="fa fa-search"></i>查询</button>
                        <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn"><i class="fa fa-times"></i>重置</button>
                    </div>
                    查询
                </div>
                <div class="panel-body">
                    <div class="col-sm-4">
                        <input type="text" class="form-control" placeholder="客户姓名" name="fullName" id="fullName" value="${params?.fullName}">
                    </div>
                </div>
            </div>
        </g:form>
        <g:if test="${flash.message}">
            <div class="row">
                <div class="hpanel">
                    <div class="panel-body">
                        <div class="alert alert-info" role="alert">${flash.message}</div>
                    </div>
                </div>
            </div>
        </g:if>
    </div>
    <div class="row">
        <div class="hpanel hgreen">
            <div class="panel-heading">
                <div class="panel-tools">
                  <sec:ifNotGranted roles="ROLE_COO">
                    <!-- <g:link action="create" class="btn btn-info btn-xs"><i class="fa fa-plus"></i>新建</g:link> -->
                  </sec:ifNotGranted>
                </div>
                所有客户
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <g:sortableColumn property="openId" title="客户标识"/>
                            <g:sortableColumn property="fullName" title="姓名"/>
                            <g:sortableColumn property="wechatNumber" title="微信号"/>
                            <g:sortableColumn property="cellphone" title="手机"/>
                            <g:sortableColumn property="city" title="城市"/>
                            <g:sortableColumn property="address" title="地址"/>
                            <!-- <g:sortableColumn property="level" title="级别"/> -->
                        </tr>
                        </thead>
                        <tbody>
                        <g:each in="${contactList}">
                            <tr>
                                <td><g:link action="show" id="${it?.id}" class="firstTd">${it?.openId}</g:link></td>
                                <td>${it?.fullName}</td>
                                <td>${it?.wechatNumber}</td>
                                <td>${it?.cellphone}</td>
                                <td>${it?.city}</td>
                                <td>${it?.address}</td>
                                <!-- <td>${it?.level}</td> -->
                            </tr>
                        </g:each>
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="panel-footer">
                <div class="pagination">
                    <g:paginate total="${contactCount ?: 0}" params="${params}"/>
                </div>
            </div>
        </div>
    </div>
</div>
<g:javascript>
    $(function(){
        $("#resetBtn").click(function () {
            $("#fullName").val("");
        })
    });

</g:javascript>
</body>
</html>
